package com.houseman.workFlow.utils;

import java.io.File;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;

public class ReadXML {

	//读取workFlow.xml中的数据
	public static void readXml() {
		try {
			//xml build工厂
			DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
			//xml在内存中的引用
			Document doc = builder.parse(new File(""));
			
			//根标签
			Element root = doc.getDocumentElement();
			Node n = root.getElementsByTagName("javaDir").item(0);
			
			String value = n.getFirstChild().getNodeValue();
			System.out.println(value);
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		} catch (SAXException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
